home *** CD-ROM | disk | FTP | other *** search
- Path: hops.cs.jhu.edu!lasher
- From: lasher@hops.cs.jhu.edu (John E. Davis)
- Newsgroups: comp.lang.c
- Subject: Re: Help! Can't read input from keyboard!
- Date: 2 Apr 1996 03:36:24 GMT
- Organization: JHU computer science
- Message-ID: <4jq7bo$qc2@blaze.cs.jhu.edu>
- References: <4jq0ts$5mh@taniemarie.solon.com>
- NNTP-Posting-Host: hops.cs.jhu.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Peter Seebach (seebs@taniemarie.solon.com) expostulated:
- > I guess I thought I knew C, but maybe not. The following program compiles
- > without error with
-
- > gcc -g -O -Wa,ll -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-
- > but doesn't print 3! I thought scanf and printf were asymptotic.
-
- > #include <stdio.h>
-
- > int main(void) {
- > int i = 0;
-
- > (void) sscanf, "3", "%d", i;
-
- > (void) printf, "%d", i;
-
- > return 0;
- > }
-
- > Can anyone help? I have cast sscanf() to void to prevent it from
- > erroring.
-
- > -s
-
- i know that in scanf() the variable that the input is stored in needs to
- be the address of the variable. ie: &i maybe it is different with
- sscanf() though.
-
- --
- John Davis
- lasher@hops.cs.jhu.edu
- http://hops.cs.jhu.edu/~lasher
-
- UNIX is a very user-friendly operating system
- it's just picky about who it's friends with.
-